/*
 * @Copyright: (C) 2019 Zhang Rida. All rights reserved.
 *
 * @Author: Zhang Rida
 * @Email: 215154317@qq.com
 * @FilePath: \WEILA_8910_PROJECT\Third-party\weilasdk\src\wlsdk\src\stream_client.h
 * @Date: 2021-02-27 17:08:35
 * @Description:
 *
 * @LastEditors: Zhang Rida
 * @LastEditTime: 2021-05-14 11:43:46
 */
#ifndef _STREAM_CLIENT_H
#define _STREAM_CLIENT_H

#include "wl_osal.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    STREAM_CLIENT_EVENT_DISCONNECTED = 0,
    STREAM_CLIENT_EVENT_CONNECTED    = 1,
    STREAM_CLIENT_EVENT_RECV_DATA    = 2
} stream_client_event;

typedef enum {
    STREAM_CLIENT_STATE_DISCONNECTED = 0,
    STREAM_CLIENT_STATE_CONNECTING   = 1,
    STREAM_CLIENT_STATE_CONNECTED    = 2
} stream_client_state;

typedef void (*stream_client_callback)(wl_uint32 event, void* data, wl_uint32 datalen);

wl_int32 stream_client_init(stream_client_callback callback);
wl_int32 stream_client_end(void);

wl_int32  stream_client_get_state(void);
wl_int32  stream_client_connect(wl_char* server_addr, wl_uint16 server_port, wl_uint32 timeout);
wl_int32  stream_client_disconnect(void);
wl_time   stream_client_get_latest_recv_timestamp(void);
wl_uint32 stream_client_get_recv_bytes(void);
wl_int32  stream_client_write_data(wl_char* data, wl_uint32 datalen);

#ifdef __cplusplus
}
#endif
#endif
